import QtQuick 2.15
import QtQuick.Controls 2.15

Item {
    id: root
    width: 150
    height: 150
    //anchors.verticalCenter: parent.verticalCenter
    //property string weigherName:"设备1"
    property int addr:240
    property int addrIndex:-1
    property int no:-1
    function getAddr(){
        var lst=[];
        for(let i=1;i<256;i++){
            lst.push(i)
        }
        return lst
    }
    Rectangle{
        id:rec
        anchors.fill:parent
        color:"#7142ED"
        Text {
            id: weigherName
            text:qsTr("设备")+(no+1).toString()+"-"+qsTr("轴")+(no+1).toString()
            font.pixelSize: 20
            font.weight: Font.Medium
            color: "white"
            height: 30
            anchors.topMargin: 0
            anchors.top: parent.top

        }
        MyComboBox{
            id:cmbAddr
            x: 15
            y: 54
            model:getAddr()
            currentIndex: addrIndex-1
            onActivated: {
                addrIndex = cmbAddr.currentIndex+1
            }
        }
    }
}
